<template>
  <div class="home">
    <el-container>
      <el-aside width="auto" style="background-color: #fff"
        ><span
          ><h4><i class="el-icon-s-order"></i>基本信息</h4></span
        ></el-aside
      >
      <el-main>
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="125px"
          class="demo-ruleForm"
        >
          <el-form-item label="商品名称" prop="name" required>
            <el-input
              v-model="ruleForm.productname"
              style="width: 220px"
            ></el-input>
          </el-form-item>
          <el-form-item label="供货商" prop="vendor" required>
            <el-select v-model="ruleForm.vendor" placeholder="请选择供货商">
              <el-option label="供货商1" value="1"></el-option>
              <el-option label="供货商2" value="2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="商品品牌" prop="brand" required>
            <el-select
              v-model="ruleForm.productbrand"
              placeholder="请选择商品品牌"
            >
              <el-option label="商品品牌1" value="1"></el-option>
              <el-option label="商品品牌2" value="2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="商品类型" prop="" required>
            <el-select
              v-model="ruleForm.region"
              placeholder="请选择商品类型"
              required
            >
              <el-option label="商品类型1" value="1"></el-option>
              <el-option label="商品类型2" value="2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="商品描述" prop="desc">
            <el-input type="textarea" v-model="ruleForm.desc"></el-input>
          </el-form-item>
        </el-form>
      </el-main>
    </el-container>
    <el-container>
      <el-aside width="auto" style="background-color: #fff"
        ><span
          ><h4><i class="el-icon-s-order"></i>规格信息</h4></span
        ></el-aside
      >
      <el-main class="el_main">
        <div class="left">
          <el-form
            :model="ruleForm"
            :rules="rules"
            ref="ruleForm"
            label-width="125px"
            class="demo-ruleForm"
          >
            <el-form-item label="大单位" prop="" required>
              <el-select v-model="ruleForm.region" placeholder="请选择，例：箱">
                <el-option label="大单位1" value="1"></el-option>
                <el-option label="大单位2" value="2"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="大单位规格" prop="" required>
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
            <el-form-item label="保质期" prop="" required>
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
            <el-form-item label="打印名称" prop="">
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
          </el-form>
        </div>
        <div class="right">
          <el-form
            :model="ruleForm"
            :rules="rules"
            ref="ruleForm"
            label-width="125px"
            class="demo-ruleForm"
          >
            <el-form-item label="小单位" prop="" required>
              <el-select v-model="ruleForm.region" placeholder="请选择，例：盒">
                <el-option label="小单位1" value="1"></el-option>
                <el-option label="小单位2" value="2"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="小单位成本价" prop="" required>
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
            <el-form-item label="换算比" prop="" required>
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
            <el-form-item label="排序" prop="">
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
          </el-form>
        </div>
      </el-main>
    </el-container>
    <el-container>
      <el-aside width="auto" style="background-color: #fff"
        ><span
          ><h4><i class="el-icon-s-order"></i>商品价格</h4></span
        ></el-aside
      >
      <el-main class="el_main">
        <div class="left">
          <el-form
            :model="ruleForm"
            :rules="rules"
            ref="ruleForm"
            label-width="125px"
            class="demo-ruleForm"
          >
            <el-form-item label="大单位成本价" prop="" required>
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
            <el-form-item label="大单位供货价" prop="" required>
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
            <el-form-item label="保护价" prop="">
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
          </el-form>
        </div>
        <div class="right">
          <el-form
            :model="ruleForm"
            :rules="rules"
            ref="ruleForm"
            label-width="125px"
            class="demo-ruleForm"
          >
            <el-form-item label="小单位成本价" prop="" required>
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
            <el-form-item label="小单位供货价" prop="" required>
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
            <el-form-item label="价格锁定" prop="">
              <el-input
                v-model="ruleForm.productname"
                style="width: 220px"
              ></el-input>
            </el-form-item>
          </el-form>
        </div>
      </el-main>
    </el-container>
    <el-container>
      <div style="margin: 0 auto">
        <el-button type="primary" @click="submitForm('ruleForm')"
          >立即创建</el-button
        >
        <el-button @click="resetForm('ruleForm')">重置</el-button>
      </div>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ruleForm: {
        id:'',
        name:'',
        price:'',
        vendor:'',
        brand:'',
        goodsType:'',
        describe:'',
        printName:'',
        number:'',
        warehouse:'',
        sort:'',
        status:'',
        img1:'',
        img2:'',
        img3:'',
        img4:'',
        img5:'',
        
        lunit:'',
        sunit:'',
        luSpec:'',
        suSpec:'',
        conversionRatio:'',
        luCostPrice:'',
        suCostPrice:'',
        luSupplyPrice:'',
        suSupplyPrice:'',
        protectionPrice:'',
        priceLock:'',

        twoBatchPrice:'',//二批价
        specialPassPrice:'',//特通价
        terminalPrice:'',//终端价
        supermarketPrice:'',//商超价
        supermarketChainPrice:'',//连锁超市价
        storesPrice:'',//a类店价
        kaStoresPrice:'',//卖店价
      },
    }
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert("submit!");
          this.$router.push('/productinformation')
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
  },
};
</script>

<style scoped>
.home {
  margin: auto;
  width: 850px;
  border: 1px solid #948e8e;
  padding: 30px;
  /* overflow-y: scroll; */
}
.el_main {
  display: flex;
}
</style>